
import Vue from "vue";
import BootstrapVue from "bootstrap-vue";


// 好像没有生效
Vue.use(BootstrapVue);

// 引入bootstrap/样式表，实测全局生效
import "bootstrap/dist/css/bootstrap.css";
import "bootstrap-vue/dist/bootstrap-vue.css";

import {Home} from "./js/home.js";
import {os} from "./hos/os.js";

console.log("程序开始了");

class Main {

    onCreate() {
        this.home = new Home("home");
        this.home.onCreate();

        this.home.onResume();
        this.top = this.home;//

        os.addBackKeyDownObserverA(()=> {
            os.makeToast("返回键按下");
        });

        // os.addBackKeyDownObserverA(()=> {
        //     os.exitA();
        // })

        os.addBackKeyDownObserverA(()=> {
            os.moveTaskToBackA();
        });
    }

    onBack() {
        console.log("返回键按下");
        if (this.top) {
            // 发给在前台的页面
            console.log("返回事件发送给" + this.top.id);
            this.top.onBack();
        }
    }

    /**
     * 获取单例
     */
    static getInstance() {
        if (window.app) {
            return window.app;
        }
        window.app = new Main();
        return window.app;
    }//
}





Main.getInstance().onCreate();
